<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.1.1.min.js"></script>
</head>
<body>
    <div>
        <input type="text" id="username">
    </div>
    <div>
        <input type="text" id="password">
    </div>
    <div>
        <button onclick="sub()">提交</button>
    </div>
</body>
<script>
    function sub(){
        var name=jQuery("#username")
        var passwd=jQuery("#password")
        console.log(name.val())
        console.log(passwd.val())
        $.ajax({
            url:"/user/login",
            method:"POST",
            data:{
                "username":name.val(),
                "password":passwd.val()
            },
            success:function(result){
                if(result == true){
                    confirm("登陆成功")
                }else{
                    confirm("登陆失败")
                }
            }
        })
    }
</script>
</html>